<template>
    <div>
      <div class="title"><span class="iconfont iconcolor">&#xe6a0;</span>热销推荐</div>
      <!--传递item的id给路由-->
      <router-link tag="div" :to="'/detail/' + item.id" class="recomment-item" v-for="item in list" :key="item.id">
        <div class="recomment-item-left">
          <img :src="item.imgUrl" alt="">
        </div>
        <div class="recomment-item-right" >
          <p class="item-title">{{item.title}}</p>
          <p class="item-desc">{{item.desc}}</p>
          <div class="item-button">查看详情</div>
        </div>
      </router-link>
    </div>
</template>

<script>
export default {
  name: 'homerecommend',
  props: {
    list: Array
  }
}
</script>

<style scoped>
  .title{
    background-color: #f5f5f5;
    line-height: 36px;
    padding-left: 15px;
    margin-top: 8px;
  }
  .iconcolor{
    color: red;
    margin-right: 3px;
  }
  .recomment-item{
    display: flex;
    padding: 10px 10px 0 10px;
  }
  .recomment-item-left{
    width: 26%;
    margin-right: 12px;
  }
  .recomment-item-left img{
    width: 100%;
  }
  .recomment-item-right{
    width: 70%;
    display: flex;
    flex-direction: column;
  }
  .item-title{
    font-size: 1.21rem;
    margin-bottom: 5px;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .item-desc{
    color: #bebebe;
    margin-bottom: 10px;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .item-button{
    line-height: 20px;
    font-size: 12px;
    width: 30%;
    text-align: center;
    color:#fff;
    border-radius: 3px;
    background-color: #ff6a00;
  }
</style>
